#i为行，a为列
i = 1
while i < 10:
    for a in range(1, i + 1):
        str = '{}*{}={:<4}'.format(a, i,a*i)
        print(str,end=' ')
    i+=1
    #换行
    print('')

print('='*80)

i=9
while i > 0:
    for a in range(1,i+1):
        str= '{}*{}={:<4}'.format(a, i,a*i)
        print(str, end=' ')
    i-=1
    print('')

print('='*80)

i=1
while i < 10:
    print('         '*(9-i),end='')
    for a in range(i,0,-1):
        str = '{}*{}={:<4}'.format(a,i,a*i)
        print(str,end=' ')
    i+=1
    print('')
print('='*80)

i=9
while i > 0:
    print('         '*(9-i),end='')
    for a in range(i,0,-1):
        str = '{}*{}={:<4}'.format(a,i,a*i)
        print(str,end=' ')
    i-=1
    print('')
print('='*80)


